/// FileName data_api_model
///
/// @Author lax
/// @Date 2023/2/24
///
/// @Description cosmic分页接口

class DataApiModel<T> {
  int? code;
  String? msg;
  T? data;
  int? count;

  bool get success {
    return code == 200;
  }

  DataApiModel({this.code, this.msg, this.data, this.count});

  factory DataApiModel.fromJson(
      Map<String, dynamic> json, T Function(dynamic json)? fromJsonT) {
    return DataApiModel<T>(
      code: json['code'] ?? json['Code'] ?? 0,
      msg: json['msg'] ?? json['Message'] ?? '',
      data: (fromJsonT != null && json['data'] != null) ? fromJsonT(json['data']) : json['data'],
      count: json['count'] ?? 0,
    );
  }

}
